Extract whitelists and blacklists from an object of class bn
, or create
them for use in structure learning.
whitelist(x)
blacklist(x)ordering2blacklist(nodes)
tiers2blacklist(tiers)
set2blacklist(set)
an object of class bn
.
a vector of character strings, the labels of the nodes.
a vector of character strings or a list, see below.
whitelist()
and blacklist()
return a matrix of character string
with two columns, named from
and to
, if whitelist or a blacklist
have been used to learn the bn
object passed as their argument.
ordering2blacklist()
, tiers2blacklist()
and
set2blacklist()
return a sanitized blacklist
(a two-column
matrix, whose columns are labeled from
and to
).
ordering2blacklist()
takes a vector of character strings (the labels
of the nodes), which specifies a complete node ordering. An object of class
bn
or bn.fit
; in that case, the node ordering is derived by the
graph. In both cases, the blacklist returned by ordering2blacklist()
contains all the possible arcs that violate the specified node ordering.
tiers2blacklist()
takes (again) a vector of character strings (the
labels of the nodes), which specifies a complete node ordering, or a list of
character vectors, which specifies a partial node ordering. In the latter
case, all arcs going from a node in a particular element of the list
(sometimes known as tier) to a node in one of the previous elements
are blacklisted. Arcs between nodes in the same element are not blacklisted.
set2blacklist()
creates a blacklist containing all the arcs between any
two of the nodes whose labels are passed as the argument set
.
# NOT RUN {
tiers2blacklist(list(LETTERS[1:3], LETTERS[4:6]))
set2blacklist(LETTERS[1:3])
ordering2blacklist(LETTERS[1:6])
# }
Run the code above in your browser using DataLab